package ProjectViewer;

import java.io.*;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.Properties;

public class Data_Project {

	
private Properties properties = new Properties();
	
	
private static final String prop_ProjectName="project_name";	
private static final String prop_ProjectPath="project_path";
private static final String prop_BasisAddres="BasisAddres";	
private static final String projectFileExtension =".pro"; 	
	

/**
 * @author Tavin
 * 
 * Date 2011.04.08
 * 
 * @return
 */

public String getProjectName()
{
	String tmpString;
	
	tmpString=properties.getProperty(prop_ProjectName);
	if (tmpString!=null)
		return(tmpString);
		
	return("");	
}
	


/**
 * @author Tavin
 * 
 * Date 2011.04.08
 * 
 * @param ProjectName
 */
public void  setProjectName(String ProjectName)
{
	properties.setProperty(prop_ProjectName, ProjectName);
}
	

	


/**
 * @author Tavin
 * 
 * Date 2011.04.08
 * 
 * @return
 */



public String getProjectPath()
{
	String tmpString;
	
	tmpString=properties.getProperty(prop_ProjectPath);
	if (tmpString!=null)
		return(tmpString);
		
	return("");	
}
	

/**
 * @author Tavin
 * 
 * Date 2011.04.08
 * 
 * @param projectPath
 */

public void  setProjectPath(String projectPath)
{
	properties.setProperty(prop_ProjectPath, projectPath);
}






public void setBasisAdress(String baseAddres)
{
	
	properties.setProperty(prop_BasisAddres,baseAddres);
	//prop_BasisAddres
}



/****************************************************************************/
/*																			*/
/*	SaveProperties									Author OG			*/
/*																			*/
/*	Description																*/
/*																			*/
/*	Version	1.0				Date 2009.11.14				Ststus : working	*/
/*																			*/
/****************************************************************************/

public void save(String fileName)
{
	FileOutputStream outFile;
	
	if (!fileName.endsWith(projectFileExtension))
	{
		fileName+=projectFileExtension;
	}

	try
	{
		outFile = new FileOutputStream(fileName);
	
	
		properties.storeToXML(outFile,"Project");
	
		outFile.close();
		}


	
		catch (Exception e) 
		{
		}
		
	
	

	
	
}



/****************************************************************************/
/*																			*/
/*	SaveProperties									Author OG			*/
/*																			*/
/*	Description																*/
/*																			*/
/*	Version	1.0				Date 2009.11.14				Ststus : working	*/
/*																			*/
/****************************************************************************/
public void load(String fileName)
{

	FileInputStream dataFile;
	

	if (!fileName.endsWith(projectFileExtension))
	{
		fileName+=projectFileExtension;
	}
	
	try
	{
		dataFile = new FileInputStream(fileName);
			
		 properties.loadFromXML(dataFile);

		 dataFile.close();
		}


	
	catch (Exception e) 
	{
	}


//	ProjectName=GetPropertyKey(PropertyKeys[Property_Name]);
//	ProjectDescription=GetPropertyKey(PropertyKeys[Property_Description]);

	
	
	
	
}





}




